#coding:utf-8
from twisted.words.xish import domish
import time

def ping(msgType,userItem,body):
        iq=userItem.botCore.IQ("get",userItem.fullJid,10)
        iq.addElement('ping', 'urn:xmpp:ping')
        defer = iq.send()
        timestamp = time.time()
        @defer.addCallback
        def result(ele):
                userItem.sendMsg(msgType,u"{0} сек".format(round(time.time() - timestamp,3)))
        
        #client.sendMsg(msgType,conference,random.choice(('olololo',u'100500 полосок',u'ты беременна!',u'и что?')),nick = nickName)

registryCommand(ping,u"ping",10,u"Тест на беременность",(u"тест",),CMD_ANY | CMD_NONPARAM)
